<template>
  <div class="ke">
    <!-- <div class="kflexc" style="padding: 20px; cursor: pointer;" @click="$router.back(-1)">
      <div><i class="el-icon-back" style="font-weight: bold; font-size: 18px;"></i></div>
      <div style="margin-left: 10px; color: rgb(86, 86, 86); font-weight: bold;">{{$route.query.plan_mobile_produced}}</div>
      <div style="margin-left: 10px; font-size: 14px;">订单ID:{{$route.query.id}}</div>
    </div> -->
    <div style="padding: 20px;">

      <div class="kflexc" style="font-size: 16px; font-weight: bold; margin:0px 0  20px 0;">
        <div><img src="https://file.storep.91haoka.cn/gantanhao/yongjin1.png" style="width: 22px; margin-right: 10px;"></div>
        <div class="flexc">
          云账户支付
          <span style="color: rgb(130, 130, 130); font-size: 14px; margin-left: 30px;">打款手续费统一6.5%</span>
        </div>
      </div>

      <!-- <div class="baibeijing" style=" width: 780px; margin-bottom: 50px;" v-if="this.apply.status!=7&&this.pay.status!=1&&this.pay.status!=2"> -->

<!--      <div class="baibeijing" style=" width: 780px; margin-bottom: 50px;">
        <div class="kflexbc">
          <div>您还未配置云账户</div>
          <div @click="xiazaiyun" style="cursor: pointer; color: #004AFF;">下载云账户说明</div>
        </div>

        <div class="kflexc" >

          <div class="kflexc" style="margin-top:15px;margin-bottom:15px">
            <div style="width: 130px;">我还没有云账户：</div>

            <div v-if="this.apply==''" @click="toregyzh(1)" class="t_yzh">注册云账户</div>

            <div v-if="this.apply.status==0" style="color: #949494;font-size: 14px;">未提交</div>
            <div v-if="this.apply.status==1" style="color: #949494;font-size: 14px;">已提交</div>
            <div v-if="this.apply.status==2" style="font-size: 14px;"><span style="color: #FF0000;">申请驳回</span></div>
            <div v-if="this.apply.status==3" style="color: #949494;font-size: 14px;">开户成功待签署</div>
            <div v-if="this.apply.status==3"><span @click="tosign" style="color: #005AFF;margin-left: 10px;cursor: pointer;" >点击进行签署</span></div>
            <div v-if="this.apply.status==4" style="color: #949494;font-size: 14px;">签约成功待开通服务</div>

            <div v-if="this.apply!=''"><span @click="toregyzh(2)" style="color: #005AFF;margin-left: 10px;cursor: pointer;" >进入查看</span></div>
            <div v-if="this.apply!=''" @click="refrestate()" class="t_yzh" style="margin-left: 5px;">更新状态</div>
          </div>

          <div class="kflexc" style="margin-left: 77px;">
            <div style="width: 130px;">我已有云账户：</div>
            <div v-if="this.apply.status==0" style="color: #949494;font-size: 14px;">未验证</div>

            <div  @click="tohavebind(1)" class="t_yzh">绑定云账户</div>
          </div>

        </div>
        <div style="background-color: #F3F4F7;color: #828282;padding: 15px;border-radius: 13px;font-size: 14px;">
          云账户是一个第三方的灵活用工平台，可以在企业和自由职业者之间搭建桥梁。 企业可以将佣金发放的工作交给云账户，由云账户来帮灵活就业人员申报个人所得税
        </div>
      </div> -->



      <!-- <div v-if="this.apply.status==7||this.pay.status==1||this.pay.status==2" class="baibeijing" style=" width: 780px; margin-bottom: 50px; background: rgb(242, 242, 242); padding: 20px; border-radius: 10px;"> -->
      <div class="baibeijing" style=" width: 780px; margin-bottom: 50px; background: rgb(242, 242, 242); padding: 20px; border-radius: 10px;">
        <div style="margin-bottom: 20px;">当前已配置云账户：</div>
        <div class="kflexc" style="margin-bottom: 20px;">
          <div v-for="item in pay" :key="item.id" style="background: rgb(255, 255, 255); padding: 30px; margin-bottom: 20px; height: 75px; line-height: 25px; border-radius: 10px; margin-right: 30px; cursor: pointer;  color: rgb(102, 102, 102);">
            <div >{{ item.dealer_id }}</div>
            <div >{{ item.name }}</div>
            <div v-if="item.status==0" @click="checkmoney(item.dealer_id)" style="color: #005AFF; font-size: 12px;">请进行打款验证</div>
            <div class="kflexbc">
              <div v-if="item.status!=0" @click="tohavebind(2,item)" style="color: #005AFF; font-size: 12px; margin-right: 10px;">查看</div>
              <div @click="tohavebind(3,item)" style="color: #005AFF; font-size: 12px; margin-right: 10px;">编辑</div>
              <div @click="shanchu(item)" style="color: #005AFF; font-size: 12px;">删除</div>


            </div>
          </div>
          <div style="background: rgb(255, 255, 255); padding: 30px; padding: 30px; height: 75px; margin-bottom: 20px; line-height: 32px; border-radius: 10px; cursor: pointer; color: rgb(102, 102, 102);"  @click="tohavebind(1)">
            <div style="margin-bottom: 10px; text-align: center; font-size: 20px; line-height: 25px;">+</div>
            <div>添加账户</div>
          </div>
        </div>
        <!-- <div @click="tohavebind(2)" style="color: #004AFF;margin-top: 15px;margin-bottom: 15px;cursor: pointer;" >{{ nowbind.name }}</div> -->

        <div style="color: #CDCDCD;font-size: 14px;" >修改云账户请联系客服处理</div>

        <div style="margin-top: 15px;">
          <div v-if="this.apply==''" @click="toregyzh(1)" style="color: #004AFF;  cursor: pointer;" >注册云账户>></div>
        </div>
        <div style="margin-top: 15px;">
          <div v-if="this.apply.status==0" style="color: #949494;font-size: 14px;">未提交</div>
          <div v-if="this.apply.status==1" style="color: #949494;font-size: 14px;">已提交</div>
          <div v-if="this.apply.status==2" style="font-size: 14px;"><span style="color: #FF0000;">申请驳回</span></div>
          <div v-if="this.apply.status==3" style="color: #949494;font-size: 14px;">开户成功待签署</div>
          <div v-if="this.apply.status==3"><span @click="tosign" style="color: #005AFF;margin-left: 10px;cursor: pointer;" >点击进行签署</span></div>
          <div v-if="this.apply.status==4" style="color: #949494;font-size: 14px;">签约成功待开通服务</div>

          <div v-if="this.apply!=''"><span @click="toregyzh(2)" style="color: #005AFF;margin-left: 10px;cursor: pointer;" >进入查看</span></div>
          <div v-if="this.apply!=''" @click="refrestate()" class="t_yzh" style="margin-left: 5px;">更新状态</div>
        </div>
        <div style="background-color: #F3F4F7; margin-top: 15px; color: #828282; border-radius: 13px; font-size: 12px;">
          云账户是一个第三方的灵活用工平台，可以在企业和自由职业者之间搭建桥梁。 企业可以将佣金发放的工作交给云账户，由云账户来帮灵活就业人员申报个人所得税
        </div>
      </div>


      <div class="kflexc" style="font-size: 16px; font-weight: bold; margin:0px 0  20px 0;">
        <div><img src="https://file.storep.91haoka.cn/gantanhao/yongjin1.png" style="width: 22px; margin-right: 10px;"></div>
        <div class="flexc">
          支付宝支付
        </div>
      </div>
      <div style="width: 780px; margin-bottom: 50px; padding: 20px; border-radius: 10px; position: relative; background: rgb(242, 242, 242);" v-if="!zhifubaoall.is_accountbook">
        <div class="kflexbc">
          <div style="margin-bottom: 20px;">您还未配置支付宝打款 <span style="font-size: 12px; margin-left: 20px; color: rgb(130, 130, 130);">开通前请确保您已拥有企业支付宝账户</span></div>

          <div @click="xiazai('https://file.storep.91haoka.cn/gantanhao/jizhangben.pdf?attname=')" style="cursor: pointer; color: #004AFF; position: absolute; right: 20px; top:20px; font-size: 12px;">下载使用说明</div>
        </div>


        <div class="kflexc" style="margin-bottom: 20px;">
          <div>1、授权敢探号</div>
          <div style="margin-left: 20px;"><el-button type="primary" plain round @click="zhifubaoshouquan">点击授权</el-button></div>
          <div style="font-size: 12px; margin-left: 20px; color: rgb(130, 130, 130);" v-if="zhifubaoall.is_sign">已成功授权</div>
        </div>
        <div class="kflexc" style="margin-bottom: 20px;">
          <div>2、开通专属记账本</div>
          <div style="margin-left: 20px;"><el-button type="primary" plain round @click="jizhangkaitong">点击开通</el-button></div>
          <div style="font-size: 12px; margin-left: 20px; color: rgb(130, 130, 130);" v-if="zhifubaoall.is_accountbook">已成功开通</div>
        </div>
        <div style="font-size: 12px; margin-left: 20px; color: rgb(130, 130, 130);">敢探号已开通支付宝服务商，您可在企业支付宝中开通自己的佣金专属记账本，把该记账本授权给我们管理，即可实现佣金转账。</div>
      </div>

      <div style="width: 780px; margin-bottom: 50px; padding: 20px; border-radius: 10px; position: relative; background: rgb(242, 242, 242);"  v-if="zhifubaoall.is_accountbook">
        <div style="margin-bottom: 20px;">您已配置支付宝打款账户：{{zhifubaoall.alipay_logon_id}}</div>
        <div class="kflexc" style="margin-bottom: 20px;">
          <div>当前记账本余额：</div>
          <div style="font-size: 30px; color: rgb(255, 0, 53); margin-left: 10px;">￥{{zhifubaoayue}}</div>

          <div style="margin-left: 20px;"><el-button type="primary" plain round @click="qianwangchongzhi">前往充值</el-button></div>
        </div>
        <div style="font-size: 12px; margin-left: 20px; color: rgb(130, 130, 130);">敢探号仅管理操作该记账本中的金额，支付佣金前请确保该金额充足。</div>
      </div>


      <div class="kflexc" style="font-size: 16px; font-weight: bold; margin:50px 0  20px 0;">
        <div><img src="https://file.storep.91haoka.cn/gantanhao/yongjin1.png" style="width: 22px; margin-right: 10px;"></div>
        <div class="flexc">
          工猫支付
          <el-switch @change="kaiqi()" v-if="!meiyou" style="margin: 0 20px;" :active-value="1" :inactive-value="0" v-model="gmform.gm_open" active-color="rgb(22, 119, 255)" inactive-color="#666"></el-switch>
          <span style="color: rgb(130, 130, 130); font-size: 14px;">一般纳税人打款手续费5.8%  &nbsp;&nbsp;&nbsp;小规模纳税人：3.4%</span>
        </div>
      </div>
      <div style="width: 780px; margin-bottom: 50px; padding: 20px; border-radius: 10px; position: relative; background: rgb(242, 242, 242);">
        <div @click="xiazaigongmao" style="cursor: pointer; color: #004AFF; position: absolute; right: 20px; top:20px; font-size: 12px;">下载配置说明</div>

        <!-- 未配置 -->
        <div v-if="meiyou">
          <div style="margin-bottom: 30px; color: rgb(64, 66, 71);" >您还未配置工猫账户</div>
          <div class="kflexc">
            <div>我还没有工猫账户：</div>
            <div class="t_yzh" @click="opencontcat" style="margin-left: 20px;" >联系我们注册开通</div>
            <div style="margin-left: 40px;">我已有工猫账户：</div>
            <div class="t_yzh" @click="openset" style=" margin-left: 20px; " >配置绑定</div>
          </div>
          <div style="color: #FF004F;margin-top: 20px;margin-bottom: 20px;font-size: 14px;">注：未通过我们注册的商户无法享受5.8%的手续费率，将沿用用户自己账户的原有手续费率。</div>
          <div style="background-color: #F3F4F7;color: #828282;padding: 15px;border-radius: 13px;font-size: 14px; margin-top: 30px;">
            与云账户功能相同，行业知名度不如云账户，但手续费更低。
          </div>
        </div>

        <div v-if="!meiyou">
          <div class="kflexc">
            <div style="margin-bottom: 30px;">已配置工猫账户</div>
          </div>
          <div class="kflexc">
            <div style="color:#1444FF;cursor: pointer;">{{ gmform.gm_name }}</div>
            <div class="t_yzh" @click="openset" style=" margin-left: 20px; " >修改配置绑定</div>
          </div>
          <div>
            <div style="margin-top: 15px;margin-bottom: 15px;">appKey：{{ gmform.gm_app_key }}</div>
            <div>appSecret：{{ gmform.gm_app_secret }}</div>
            <div class="flexc" style="margin-top: 15px;" v-if="gmform.gm_broker_id">
              <div>serviceld：{{gmform.gm_broker_id}}</div>
            </div>

          </div>

        </div>

        <!-- 已配置 -->
        <!-- <div v-if="!isshowgmset&&gminfo!=''" >
          <div style="margin-bottom: 30px;">已配置工猫账户</div>
          <div class="flexc">
            <div style="color:#1444FF;cursor: pointer;" @click="showgminfo=true">{{ gminfo.dealer_id }}</div>
            <div style="margin-left: 40px;">状态：
              <span v-if="gminfo.status==0">未验证</span>
              <span v-if="gminfo.status==1||gminfo.status==2">正常</span>
            </div>
            <div v-if="gminfo.status==0" class="t_yzh" @click="openset" style="margin-left: 20px;" >配置绑定</div>
          </div>
          <div v-if="showgminfo" >
            <div style="margin-top: 15px;margin-bottom: 15px;">appKey：{{ gminfo.gm_app_key }}</div>
            <div>appSecret：{{ gminfo.gm_des_key }}</div>

            <div class="flexc" style="margin-top: 15px;" v-if="gminfo.broker_id && !broker_idlog">
              <div> serviceld：{{gminfo.broker_id}}，非默认</div>
              <div class="t_yzh" @click="broker_idlog = true" style="margin-left: 20px;" >修改</div>
            </div>

            <div class="flexc" style="margin-top: 15px;" v-if="broker_idlog">
              <div style="margin-right: 20px;"> serviceld：</div>
              <div><el-input v-model="gminfo.broker_id" style="width: 260px; margin-right: 20px;" placeholder="请输入serviceld"></el-input></div>
              <div class="t_yzh" @click="queren2" style="margin-left: 20px;" >确认设置</div>
            </div>

          </div> -->

<!--          <div style="color: #FF004F;margin-top: 20px;margin-bottom: 20px;font-size: 14px;">注：未通过我们注册的商户无法享受5.8%的手续费率，将沿用用户自己账户的原有手续费率。</div>
          <div style="background-color: #F3F4F7;color: #828282;padding: 15px;border-radius: 13px;font-size: 14px; margin-top: 30px;">
            与云账户功能相同，行业知名度不如云账户，但手续费更低。
          </div> -->
        </div>


    </div>
    <!-- 联系我们 -->
    <el-dialog  title="联系我们"  :visible.sync="isshowus"  width="500px">
      <img style="width: 100%;" src="https://file.storep.91haoka.cn/gantanhao/yongjin3.jpg">
    </el-dialog>

    <!-- 配置 -->
    <el-dialog  title="配置工猫账户"  :visible.sync="isshowgmset"  width="500px" :close-on-click-modal="false" :close-on-press-escape="false">
      <div>请按照下载的配置说明配置</div>
      <div style="margin: 10px 0;">appKey：</div>
      <div style="margin-bottom: 20px;"><el-input v-model="gmform.gm_app_key" style="width: 260px; margin-right: 20px;" placeholder="请输入"></el-input></div>
      <div style="margin: 10px 0;">appSecret：</div>
      <div style="margin-bottom: 20px;"><el-input v-model="gmform.gm_app_secret" style="width: 260px; margin-right: 20px;" placeholder="请输入"></el-input></div>
      <div style="margin: 10px 0;">serviceID：</div>
      <div style="margin-bottom: 20px;"><el-input v-model="gmform.gm_broker_id" style="width: 260px; margin-right: 20px;" placeholder="请输入"></el-input></div>
      <div style="background-color: #F3F4F7;color: #828282;padding: 15px;border-radius: 13px;font-size: 14px; margin-top: 30px;margin-bottom: 30px;">
        与云账户功能相同，行业知名度不如云账户，但手续费更低。
      </div>

      <div slot="footer" class="dialog-footer">
        <el-button type="primary" round @click="quedingpeizhigm">保存配置</el-button>
      </div>
    </el-dialog>

    <el-dialog  title="充值"  :visible.sync="chongzhilog"  width="500px" :close-on-click-modal="false" :close-on-press-escape="false">
      <div class="kflexc">
        <div style="margin: 10px 0;">请输入金额：</div>
        <div style=""><el-input type="number" v-model="chongzhi.trans_amount" style="width: 260px; margin-right: 20px;" placeholder="请输入金额"></el-input></div>
      </div>


      <!-- <div style="margin: 10px 0;">请输入备注：</div>
      <div style="margin-bottom: 20px;"><el-input v-model="chongzhi.remark" style="width: 260px; margin-right: 20px;" placeholder="请输入"></el-input></div> -->

      <div slot="footer" class="dialog-footer">
        <el-button type="danger" round @click="chongzhigo">充值</el-button>
      </div>
    </el-dialog>

    <zhuce v-if="zhucelog"></zhuce>
    <bangding v-if="bangdinglog" :nowtype="nowtype" :now="now" @bangdingok="bangdingok"></bangding>
  </div>
</template>

<script>
  import axios from 'axios'
  import zhuce from './zhuce.vue'
  import bangding from './bangding.vue'
  export default {
    components:{
      zhuce,bangding
    },
    name: "yonjindakakuanpeizhi",
    data() {
      return {
        zhucelog:false,
        bangdinglog:false,
        nowtype:1,
        now:"",

        apply:"",
        pay:"",
        nowbind:{},


        isshowus:false,
        isshowgmset:false,
        gmform:{
          gm_broker_id:"",
          gm_app_key:"",
          gm_app_secret:"",
          gm_open:""
        },
        yue:0,
        meiyou:true,
        zhifubaoall:"",
        zhifubaoayue:0,
        chongzhilog:false,
        chongzhi:{
          trans_amount:"",
          remark:""
        }
      }
    },
    created() {
      this.getgongmao()
      this.getzhifubao()

      this.getyzhinfo()
    },
    mounted() {

    },
    methods: {
      shanchu:function(item){
        this.$confirm('确定删除吗', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          axios.post('/api/plan-market/yunzhifu/deleteYunAccount',{id:item.id}).then((response)=>{
            if (response.data.msg.code == 0) {
              this.$message({
                message: '删除成功',
                type: 'success'
              });
              this.getyzhinfo()
            } else {
              this.$message.error(response.data.msg.info);
            }
          })
        })
      },

      bangdingok:function(){
        this.getyzhinfo()
      },
      //打款验证
      checkmoney(dealer_id){
        this.$confirm('我们将会使用您的云账户打款1分钱到我们的个人账户，用来测试是否绑定成功，1分钱不会退款。请先确保云账户余额大于1分钱再点击测试', '提示', {
          confirmButtonText: '测试',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          axios.post('/api/plan-market/yunzhifu/testApiToken',{dealer_id:dealer_id}).then((response)=>{
            if (response.data.msg.code == 0) {
              this.$message({
                message: '验证成功',
                type: 'success'
              });
              //获取详情
              this.getinfo()
            } else {
              this.$message.error(response.data.msg.info);
            }
          })
        }).catch(() => {
          this.$message({
            type: 'info',
            message: '已取消'
          });
        });

      },

      //点击进行签署
      tosign(){
        axios.get('/api/plan-market/yunzhifu/getContractUrl').then((response)=>{
          if (response.data.msg.code == 0) {
            window.open(response.data.data.sign_url,'_blank')
          } else {
            this.$message.error(response.data.msg.info);
          }
        })
      },

      xiazaiyun:function(){
        window.open('https://static.91haoka.cn/yunzhanghu2.pdf')
      },

      //已有账户绑定
      tohavebind(type,item){
        this.nowtype = type
        this.now = item
        this.bangdinglog = false
        this.$nextTick(()=>{
          this.bangdinglog = true
        })
        // this.$router.push({path:'/yzhbind',query:{type:type}})
      },

      //注册云账户
      toregyzh(type){
        //1--注册
        //2--编辑
        this.zhucelog = false
        this.$nextTick(()=>{
          this.zhucelog = true
        })
        // this.$router.push({path:'/yzhregister',query:{type:type}})
      },

      refrestate(){
        axios.get('/api/plan-market/yunzhifu/getSubmitInfo').then((response)=>{
            if (response.data.msg.code == 0) {
              console.log('获取详情')
              //获取云账户配置
              this.getyzhinfo()
            } else {
              this.$message.error(response.data.msg.info);
            }
          })

      },

      //获取详情
      getinfo(){
        axios.get('/api/plan-market/yunzhifu/getApiToken').then((response)=>{
          if (response.data.msg.code == 0) {
            this.nowbind = response.data.data
          } else {

            this.$message.error(response.data.msg.info);
          }
        })
      },

      //获取云账户配置
      getyzhinfo(){
        axios.post('/api/plan-market/yunzhifu/getYunAccount').then((response)=>{
        	if (response.data.msg.code == 0) {
            this.apply = response.data.data.apply
            this.pay = response.data.data.pay
            // 是否绑定成功
            if(this.apply.status==7||this.pay.status==1||this.pay.status==2){
                //获取详情
                this.getinfo()
                if(this.pay.status!=0){
                  this.openys = this.pay.status
                }

            }
        	} else {
        		this.$message.error(response.data.msg.info);
        	}
        })
      },

      //支付宝相关
      chongzhigo:function(){
        axios.post('/api/plan-market/ali/safe/user/account/pay',this.chongzhi).then((response)=>{
          if (response.data.msg.code == 0) {
            window.open(response.data.data)

          } else {
            this.$message.error(response.data.msg.info);
          }
        })
      },
      qianwangchongzhi:function(){
        this.chongzhi = {
          trans_amount:"",
          remark:""
        }
        this.chongzhilog = true
      },
      getzhifubao:function(){
        axios.get('/api/plan-market/ali/safe/config/get').then((response)=>{
          if (response.data.msg.code == 0) {
            this.zhifubaoall = response.data.data
          } else {
            // this.$message.error(response.data.msg.info);
          }
        })
        axios.get('/api/plan-market/ali/safe/user/account/query').then((response)=>{
          if (response.data.msg.code == 0) {
            this.zhifubaoayue = response.data.data.available_amount
          } else {
            // this.$message.error(response.data.msg.info);
          }
        })
      },
      jizhangkaitong:function(){
        axios.post('/api/plan-market/ali/safe/user/account/create').then((response)=>{
          if (response.data.msg.code == 0) {

            this.$message.success('开通成功');
            this.getzhifubao()
          } else {
            this.$message.error(response.data.msg.info);
          }
        })
      },
      zhifubaoshouquan:function(){
        axios.post('/api/plan-market/ali/safe/user/agreement/sign').then((response)=>{
          if (response.data.msg.code == 0) {
            window.open(response.data.data)
            // this.$message.success('签约成功');
          } else {
            this.$message.error(response.data.msg.info);
          }
        })
      },
      zhifubaobushouquan:function(){
        axios.post('/api/plan-market/ali/safe/user/agreement/unsign').then((response)=>{
          if (response.data.msg.code == 0) {
            this.$message.success('解约成功');
          } else {
            this.$message.error(response.data.msg.info);
          }
        })
      },
      zhifubaojizhangben:function(){
        axios.post('/api/plan-market/ali/safe/user/account/create').then((response)=>{
          if (response.data.msg.code == 0) {
            this.$message.success('开通成功');
          } else {
            this.$message.error(response.data.msg.info);
          }
        })
      },
      zhifubaojizhangbencha:function(){
        axios.post('/api/plan-market/ali/safe/user/account/query').then((response)=>{
          if (response.data.msg.code == 0) {
            //记账本查询
          } else {
            this.$message.error(response.data.msg.info);
          }
        })
      },
      //支付宝相关



      kaiqi:function(){
        this.quedingpeizhigm()
      },
      xiazai:function(url){
        window.location = url
      },
      xiazaigongmao:function(){
        const a = document.createElement('a');
        a.setAttribute('download', '工猫说明文档.pdf');
        a.setAttribute('href', 'https://file.storep.91haoka.cn/gantanhao/gongmaogth.pdf');
        a.click();
      },
      //打开联系我们
      opencontcat(){
        this.isshowus = true
      },
      //配置工猫
      openset(){
        this.isshowgmset = true
      },
      getgongmao:function(){

        axios.get('/api/plan-market/gongmao/balance').then((response)=>{
          if (response.data.msg.code == 0) {
            this.yue = response.data.data
          } else {
            // this.$message.error(response.data.msg.info);
          }
        })

        axios.get('/api/plan-market/gongmao/config/get').then((response)=>{
          console.log(response.data.data)
          if (response.data.msg.code == 0) {

            if(response.data.data){
              this.gmform = response.data.data
            }else{
              this.gmform = {
                gm_broker_id:"",
                gm_app_key:"",
                gm_app_secret:"",
                gm_open:""
              }
            }
            if(this.gmform.gm_app_key){
              this.meiyou = false
            }
          } else {
            // this.$message.error(response.data.msg.info);
          }
        })

      },

      //保存工猫
      quedingpeizhigm:function(){
        if(this.gmform.gm_app_key == '' || this.gmform.gm_app_secret == '' || this.gmform.gm_broker_id == ''){
          this.$message.error('信息未填写完整');
          return
        }
        console.log(this.gmform)
        this.$confirm('是否确认操作', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          console.log(this.gmform)
          axios.post('/api/plan-market/gongmao/config',this.gmform).then((response)=>{
            if (response.data.msg.code == 0) {
              this.$message.success('保存成功');
              this.isshowgmset = false
            } else {
              this.$message.error(response.data.msg.info);
            }
          })
        })
      }
    }
  }
</script>

<style lang="scss" scoped>
  .ke {
    .t_yzh{
      color: #005AFF;
      background-color: #E4EDFF;
      padding: 5px 10px;
      border-radius: 25px;
      font-size: 12px;
      cursor: pointer;
    }
  }
</style>
